package com.test.jaxb;

import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;

public class JaxbClient
{
	public static void main(String[] args) throws Exception
	{
		Parent parent = new Parent();
		
		parent.setParentName("zhangsan");
		parent.setParentAddress("beijing");
		
		Boss boss = new Boss();
		
		boss.setBossName("lisi");
		boss.setBossAge(20);
		boss.setParent(parent);
		
		Teacher teacher = new Teacher();
		
		teacher.setTeacherName("wangwu");
		teacher.setTeacherAddress("shanghai");
		teacher.setBoss(boss);
		
		Student student = new Student();
		
		student.setWelcome("student");
		student.setStudentAge(15);
		student.setStudentAddress("tianjin");
		student.setTeacher(teacher);
		
		JAXBContext context = JAXBContext.newInstance(Student.class);
		
		Marshaller marshaller = context.createMarshaller();
		
		marshaller.marshal(student, System.out);
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
	}
}
